<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/axios/0.27.2/axios.min.js"></script>
    <link rel="stylesheet" href="./index.css">
    <link rel="stylesheet" href="//at.alicdn.com/t/c/font_3480126_q9hrksv5bq.css"></link>
    
</head>

<body>
    <div class="nav">
        <div class="con">
            <div class="left">
            </div>
            <div class="right">
                <div class="list">
                    <ul>
                        <li class="hd">首页</li>
                        <li class="hd">书库</li>
                        <li class="hd">排行榜</li>
                        <li class="hd">作家专区</li>
                        <li class="hd">作家福利</li>
                    </ul>
                </div>
                <div class="list2">
                    <div class="search">
                        <div class="ipt"><input type="text" placeholder="请输入书名或者作者" class="ptt"></div>
                        <div class="searchList">
                            <button class="sr"><i class="iconfont icon-sousuo"></i></button>
                        </div>
                    </div>
                    <div class="lr">
                        <span class="llrr">登录</span>
                        <span class="s">|</span>
                        <span class="llrr">注册</span>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="main">
        <div class="container">
            <div class="image">
                <div class="d1">
                    <img src="" alt="" class="dimg">
                </div>
                <div class="sum">
                    <p class="title"></p>
                    <div class="read_state">
                        <ul>
                            <li><span class="read"></span> 万字</li>
                            <li><span class="read"></span> 人在读</li>
                        </ul>
                    </div>
                    <div class="lastest">
                        <ul>
                            <li>最近更新： <span></span> </li>
                            <li><span class="update"></span> </li>
                        </ul>
                    </div>
                    <div class="start_read">
                        <button class="reading">开始阅读</button>
                    </div>
                </div>
            </div>
            <div class="author">
                <div class="dd">
                    <div class="avatar">
                        <img src="" alt="" class="himg">
                    </div>
                    <div class="name">
                        <div class="l"><img src="" alt="" class="dd11"></div><div class="ava"></div>
                    </div>
                    <div class="sy">
                        <div class="word"></div>
                    </div>
                </div>
            </div>
        </div>
        <div class="container1">
            <div class="introduce">
                <h2>作品简介</h2>
            </div>
            <div class="summary">
                <p class="text">

                </p>
            </div>
            <div class="chapter">
                <h2>章节目录 · <span class="num"></span>章</h2>
            </div>
            <div class="chapter_list">
                <ul class="chapters"></ul>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="ff">
            <div class="cont">
                <div class="left">
                    <div class="top">
    
                    </div>
                    <div class="cc">
                        
                    </div>
                    <div class="ft">
                        <ul>
                            <li>2022 北京时光荏苒科技有限公司</li>
                            <li>京ICP备18018851号-8 |京公网安备 11010802030409号 | 京ICP证 京B2-20200085号 |</li>
                            <li>网络文化经营许可证：京网文[2020]1043-169号</li>
                            <li>请使用者仔细阅读《番茄小说网用户协议》、《番茄小说网隐私政策》说明</li>
                            <li>广告投放：www.oceanengine.com    不良信息举报：fanqiejubao@bytedance.com</li>
                            <li>意见建议邮箱：original_articles@bytedance.com    版权咨询：1748420113@qq.com</li>
                        </ul>
                    </div>
                </div>
            </div>
            <div class="right">
                <div class="xcx">
                    <div class="ig">
                        <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/5180eh7pldnuhog/muye-novel-web-pc/dycode.png" alt="">
                    </div>
                    <div class="tx">
                        <p><i class="iconfont icon-douyin"></i> 打开抖音扫码关注官方账号</p>
                    </div>
                </div>
                <div class="code_ma">
                    <div class="m">
                        <img src="https://lf3-static.bytednsdoc.com/obj/eden-cn/5180eh7pldnuhog/muye-novel-web-pc/wechat.png" alt="">
                    </div>
                    <div class="tt">
                        <p><i class="iconfont icon-weixin1"></i> 扫码关注微信公众号</p>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        // 根据id拿到数据
        let dimg = document.querySelector(".dimg")
        let title = document.querySelector(".title")
        let read = document.querySelectorAll(".read")
        let update = document.querySelector(".update")
        let text = document.querySelector(".text")
        let chaptered = document.querySelector(".chapters")
        let num = document.querySelector(".num")
        let dd11 = document.querySelector(".dd11");
        let ava = document.querySelector('.ava');
        let himg = document.querySelector(".himg");
        let word = document.querySelector(".word");
        const result = async () => {
            let idx = location.href.split("?")[1]
            let params = {
                id: idx
            }
            let res = await axios.post('/novelsList', params)
            let data = res.data.data[0]
            dimg.src = data.img
            title.innerHTML = data.name
            read[0].innerHTML = data.count
            read[1].innerHTML = data.isReading
            update.innerHTML = data.lastest_update
            text.innerHTML = data.summary
            let chapter_list = {
                chapter_book_id:data.chapter_book_id
            }
            let chapters = await axios.post('/crcontent', chapter_list)
            let cp = chapters.data.data
            num.innerHTML = cp.length
            cp.map(el=>{
                let li = document.createElement("li");
                li.innerHTML = el.chapter_name;
                chaptered.appendChild(li);
            })
            // 作者
            let authors = await axios.post('/authors', params)
            // console.log(authors)
            let info = authors.data.data[0]
            himg.src=info.author_avatar
            dd11.src=info.tag
            ava.innerHTML=info.author_name
            word.innerHTML = info.author_intr
        }
        result()
        let btnd = document.querySelector(".sr");
        let ptt = document.querySelector(".ptt");
        btnd.addEventListener("click", ()=>{
            let val = ptt.value;
            if(val==='') return;
            window.location.href = `/public/search/index.html?${val}` 
        })
    </script>
</body>

</html>